refactor: nightly simplification sweep [automated]#635
Conversation
Code Review: PR #635Verdict: REQUEST CHANGES Summary: This PR extracts duplicated recording-stop snapshot logic from Blockers (must fix before merge)None. No correctness, security, or data-loss issues. Should fix (strongly recommended)1. Restore the removed ordering comment ( The original code had this comment: // Snapshot capture health BEFORE stop, since the system-audio backend
// can clean up buffer counters before file-close completion resumes.This was removed in the refactoring. The comment documents a non-obvious ordering constraint — the snapshot must be captured before Suggested fix — add a doc comment on the factory method: /// Snapshot capture health before the stop call, since the system-audio
/// backend can clean up buffer counters before file-close completion resumes.
private func makeRecordingStopSnapshot() -> RecordingStopSnapshot {Or alternatively, keep an inline comment at each call site. The factory doc comment is preferred since it protects both callers and centralizes the rationale. Nits (take or leave)1.
private struct RecordingStopSnapshot {
// ...
let durationSeconds: TimeInterval
let durationMilliseconds: Int // ← always Int(durationSeconds * 1000)
// ...
}A computed property eliminates the redundant stored value: var durationMilliseconds: Int { Int(durationSeconds * 1000) }This is minor — the struct is private and the factory correctly derives it — but a computed property makes the relationship explicit and removes a potential consistency hazard if someone later constructs the struct manually with mismatched values. What looks good
Generated by Claude Code |
Automated simplification pass. See diff for details.